package com.macro.mall.commission.service;

import com.github.pagehelper.Page;
import com.macro.mall.commission.domain.OrderSettle;
import com.macro.mall.commission.entity.OrderSettleEntity;
import com.macro.mall.commission.service.bo.InsertOrderSettleInput;
import com.macro.mall.commission.service.bo.PagedQueryOrderSettleInput;
import com.macro.mall.commission.service.bo.UpdateOrderSettleInput;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 订单佣金结算Service
 *
 * @author xuyanjun
 * @date 2019-12-11
 */
public interface OrderSettleService {

    /**
     * 结算
     *
     * @param orderId 订单id
     */
    void settle(long orderId);

    /**
     * 新增订单佣金结算
     *
     * @param input input
     * @return 新增id
     */
    long insert(InsertOrderSettleInput input);

    /**
     * 修改订单佣金结算
     *
     * @param input input
     */
    void update(UpdateOrderSettleInput input);

    /**
     * 删除订单佣金结算
     *
     * @param id id
     */
    void delete(long id);

    /**
     * 根据Id获取订单佣金结算
     *
     * @param id id
     * @return 订单佣金结算
     */
    OrderSettleEntity getById(long id);

    /**
     * 根据批量Id获取订单佣金结算
     *
     * @param batchIds 批量ids
     * @return 订单佣金结算集合
     */
    List<OrderSettleEntity> listByBatchIds(List<Long> batchIds);

    /**
     * 根据订单Id获取订单佣金结算
     *
     * @param orderId 订单Id
     * @return 订单佣金结算集合
     */
    List<OrderSettleEntity> listByOrderId(long orderId);

    /**
     * 获取所有未到账的结算记录
     *
     * @param createTimeEndTime   创建时间开始时间
     * @param createTimeBeginTime 创建时间结束时间
     * @return 生活订单佣金分配结算
     */
    List<OrderSettleEntity> listUnArrived(LocalDateTime createTimeBeginTime, LocalDateTime createTimeEndTime);

    /**
     * 分页查询
     *
     * @param input input
     * @return 分页的订单佣金结算
     */
    Page<OrderSettleEntity> pagedQuery(PagedQueryOrderSettleInput input);

    /**
     * 将实体对象转换成domain对象
     *
     * @param orderSettleEntity 实体
     * @return orderSettle
     */
    OrderSettle entityToDomain(OrderSettleEntity orderSettleEntity);

    /**
     * 将实体对象转换成domain对象
     *
     * @param orderSettleEntities 实体
     * @return orderSettles
     */
    List<OrderSettle> entityToDomain(List<OrderSettleEntity> orderSettleEntities);

}